
#include "LayerAnimationsTest.h"

USING_NS_CC;

bool AnimationsTestLayer::init()
{

	auto winSize = Director::sharedDirector()->getWinSize();
	auto sprt = Sprite::create();
	sprt->setPosition(Vec2(winSize.width/2,winSize.height/2));
	this->addChild(sprt);

	auto animation = Animation::create();

	for (int i = 1; i < 5; i++)
	{
		char szName [100] = {0};
		sprintf_s(szName,"animations/grossini_dance_%02d.png", i);
		animation->addSpriteFrameWithFile(szName);
	}

	animation->setDelayPerUnit(2.0f/4.0f);
	auto action = Animate::create(animation);
	sprt->runAction(RepeatForever::create(Sequence::create(action,NULL)));
	return true;
}
